package appml

import (
	"log"
	"runtime"
)

func (m *AppManager) checkProcessesTick() {
	for range m.processCheckTicker.C {
		m.checkProcesses()
	}
}

func (m *AppManager) checkProcesses() {
	m.mu.Lock()
	defer m.mu.Unlock()
	log.Printf("开始检查进程状态")
	if err := m.procmgr.CheckAndStart(); err != nil {
		log.Printf("check processes error: %v", NewErr(runtime.Caller(0)).Err(err))
	}
	log.Printf("检查进程状态完成")
}
